package com.lu.adog.demo.main;

import com.lu.adog.demo.main.data.model.ItemModel;

import java.util.List;

/**
 * @author Yue
 * @date 2017/11/15 14:22
 */

public class MainPresenter implements ILinkMain.Presenter {

    private ILinkMain.View mView;
    private long mExitTime;
    private ILinkMain.Task mTask;
    private List<ItemModel> itemModelList;

    @Override
    public void start() {
    }

    @Override
    public ILinkMain.Presenter bind(ILinkMain.View view, ILinkMain.Task task) {
        view.setPresenter(this);
        mView = view;
        mTask = task;
        return this;
    }

    @Override
    public ILinkMain.View getMvpView() {
        return mView;
    }

    @Override
    public ILinkMain.Task getMvpTask() {
        return mTask;
    }

    @Override
    public void onQuickClickExit() {
        if ((System.currentTimeMillis() - mExitTime) > 2000) {
            mView.exitAlertMess();
            mExitTime = System.currentTimeMillis();
        } else {
            mView.exitApp();
        }
    }

    @Override
    public List<ItemModel> getItemModelList() {
        return null;
    }

    public ILinkMain.Task getmTask() {
        return mTask;
    }
}
